/*******************************************************************************
 * Copyright (c) 2006 CEA List.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     CEA List - initial API and implementation
 *******************************************************************************/
package com.cea.papyrus.core.helper;

import java.util.ArrayList;

import org.eclipse.uml2.uml.Element;

import com.cea.papyrus.diagraminterchange2.di2.Diagram;
import com.cea.papyrus.diagraminterchange2.di2.GraphNode;

/**
 * 
 */
public interface INodeHelper {
	
	/**
	 * This method creates an umlElement.
	 * 
	 * @param name name of the uml Element to create
	 * @param parent the uml elment parent
	 * if null the elment is create at the model level
	 * 
	 * @return the created the uml Element
	 */
	public org.eclipse.uml2.uml.Element createElement(String name, org.eclipse.uml2.uml.Element parent);
	
	/**
	 * This method creates an umlElement.
	 * 
	 * @param parent the uml elment parent
	 * if null the elment is create at the model level
	 * 
	 * @return the created the uml Element
	 */
	public org.eclipse.uml2.uml.Element createElement( org.eclipse.uml2.uml.Element parent);
	
	/**
	 * This methods adds a umlElement to a umlParent.
	 * 
	 * @param element the element to add
	 * @param umlParent the umlParent that owns the element
	 * 
	 * @return <code>true</code> if the element was added to its umlParent
	 */
	public boolean addElement( org.eclipse.uml2.uml.Element element, org.eclipse.uml2.uml.Element umlParent);
	
	
	/**
	 * This methods removes an umlElement to its owner umlParent.
	 * 
	 * @param element the element to remove
	 * @param umlParent the umlParent of the element to remove
	 * 
	 * @return <code>true</code> if the element was removed
	 */
	public boolean removeElement(org.eclipse.uml2.uml.Element element, org.eclipse.uml2.uml.Element umlParent);
	
	/**
	 * This method creates a graphNode and an associated umlElement.
	 * 
	 * @param name name of the uml Element to create
	 * @param parent the graphical Node that content the future Element
	 * if null the elment is create a model level
	 * 
	 * @return the created GrahNode
	 */
	public GraphNode createGraphNode();
	
	/**
	 * this method creates a graph node in a given diagram for a given uml Element.
	 * 
	 * @param umlElement this is the uml Element that will have a new graphNode
	 * @param diagram this is diagram that will contain the new graphNode
	 * 
	 * @return list of created graphNodes
	 */
	public ArrayList createGraphNode(Element umlElement, Diagram diagram);
	
	/**
	 * this method is used to know if an element to a parentGraphNode.
	 * 
	 * @param the parent graphNode
	 * *
	 * @param parent 
	 * 
	 * @return 
	 */
	public boolean canExecute(GraphNode parent);
	
	/**
	 * this method is used to know if parent can be the owner of the umlElement to create.
	 * 
	 * @param umlParent the parent to test
	 * *
	 * 
	 * @return 
	 */
	public boolean canExecuteCreateElement(Element umlParent);
}
